<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>simGetVisionSensorDepthBuffer</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
</head>

<body>

<div align="center">
<table class=allEncompassingTable >
 <tr>
  <td >
<p><a href="../../index.html" TARGET="_top"><img src="../images/homeImg.png"></a></p>

<h1><a href="../apiOverview.htm">Regular API</a> function</h1>
<h3 class=subsectionBar><a name="simGetVisionSensorDepthBuffer" id="simGetVisionSensorDepthBuffer"></a>simGetVisionSensorDepthBuffer / sim.getVisionSensorDepthBuffer</h3>
<table class=apiTable>
<tr class=apiTableTr> 
<td class=apiTableLeftDescr>
Description 
</td> 
<td class=apiTableRightDescr>Retrieves the depth buffer (or a portion of it) of a vision sensor. Use <a href="simGetVisionSensorResolution.htm">sim.getVisionSensorResolution</a> to know the resolution of the full depth buffer. The returned data doesn't make sense if <a href="simHandleVisionSensor.htm">sim.handleVisionSensor</a> wasn't called previously (sim.handleVisionSensor is called by default in the main script if the vision sensor is not tagged as <em>explicit handling</em>).<br></td>
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCSyn>
C synopsis
</td> 
<td class=apiTableRightCSyn>simFloat* simGetVisionSensorDepthBuffer(simInt sensorHandle)<br></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCParam>C parameters</td> 
<td class=apiTableRightCParam>
<div><strong>sensorHandle</strong>: handle of the vision sensor. Can be combined with <a href="../apiConstants.htm#specialHandleFlags">sim_handleflag_depthbuffermeters</a> (simply add sim_handleflag_depthbuffermeters to sensorHandle), if you wish to retrieve values in meters.</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCRet>
C return value
</td> 
<td class=apiTableRightCRet>
<div>depth buffer (buffer size is resolutionX*resolutionY) or nullptr in case of an error. The user is in charge of releasing the returned buffer with <a href="simReleaseBuffer.htm">simReleaseBuffer</a>. Returned values are in the range of 0-1 (0=closest to sensor (i.e. close clipping plane), 1=farthest from sensor (i.e. far clipping plane)). If the sim_handleflag_depthbuffermeters was specified, then individual values are expressed as distances in terms of meters.<br>
</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLSyn>
Lua synopsis
</td> 
<td class=apiTableRightLSyn>table depthBuffer=sim.getVisionSensorDepthBuffer(number sensorHandle,number posX=0,number posY=0,number sizeX=0,number sizeY=0)<br></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLParam>Lua parameters</td> 
<td class=apiTableRightLParam>
<div><strong>sensorHandle</strong>: same as for the C function. Additionally, can also be combined with <a href="../apiConstants.htm#specialHandleFlags">sim.handleflag_codedstring</a> (simply add sim.handleflag_codedstring to sensorHandle), if you wish to retrieve a string buffer (sim.buffer_float) instead of a table. In that case, refer also to <a href="simTransformBuffer.htm">sim.transformBuffer</a>.</div>
<div><strong>posX / posY</strong>: position of the depth buffer portion to retrieve. Zero by default.</div>
<div><strong>sizeX / sizeY</strong>: size of the depth buffer portion to retrieve. Zero by default, which means that the full depth buffer should be retrieved</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLRet>
Lua return values
</td> 
<td class=apiTableRightLRet>
<div><strong>depthBuffer</strong>: table containing depth values (table size is sizeX*sizeY), a string containing coded depth values. Returned values are in the range of 0-1 (0=closest to sensor (i.e. close clipping plane), 1=farthest from sensor (i.e. far clipping plane)). If the sim.handleflag_depthbuffermeters was specified, then individual values are expressed as distances in meters.</div></td> 
</tr> 

<tr class=apiTableTr> 
<td class=remApiTableLeftCParam>
Remote API equiv.
</td> 
<td class=remApiTableRightCParam>
<div>B0-based remote API: <a href="../b0RemoteApi-cpp.htm#simxGetVisionSensorDepthBuffer">simxGetVisionSensorDepthBuffer</a></div>
<div>Legacy remote API: <a href="../remoteApiFunctions.htm#simxGetVisionSensorDepthBuffer">simxGetVisionSensorDepthBuffer</a></div>
</td> 
</tr> 

</table> 

<br>
<p><a href="../apiFunctions.htm">All regular API functions on one page</a></p>
<br>
<br>
</td>
</tr>
</table>
</div>
</body>
</html>
